<template>
  <div class="tn">
    <van-sticky :offset-top="0">
    <van-nav-bar
      :title=title
      left-text="返回"
      :right-text=tnName
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
    </van-sticky>
  </div>
</template>

<script>
  import { Toast } from 'vant';

  export default {
    props:['tnName','title'],
    methods: {
      onClickLeft() {
         this.$router.go(-1)
      },
      onClickRight() {
        if( this.tnName== "注册"){
          this.$router.push('/register')
        }
        if( this.tnName== "登录"){
          this.$router.push('/login')
        }
        if( this.tnName== "清空购物车"){
          //执行清空购物车方法
          //重新跳转回购物车页面
          this.$router.push('/login')
        }
      },
    },
  };
</script>

<style>
</style>
